package collection;

public class Test {
    public static void main(String[] args) {
        Dog dog3 = new Dog();
        dog3.eat();//目前没有继承
        dog3.sleep();// 继承后可以使用父类继承方法

        Animal a=new Animal();
        a.sleep();// 只有sleep()

        Animal aDog=new Dog();// 向上造型
        aDog.sleep();

        Dog dog4= (Dog) aDog; // 向下造型
        dog4.sleep();
        dog4.eat();








        System.out.println("----------------以下不要看");
        Dog dog = new Dog();
        dog.age=4;
        dog.name="小黄";

        System.out.println(dog);

        Dog dog2 = new Dog();
        dog2.age=4;
        dog2.name="小黄";

        System.out.println(dog==dog2);// false
        System.out.println(dog.equals(dog2));// false  重写equals ，true
    }
}
